home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS04.ADF
/
image.ed
/
dosrequest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1985-10-26
|
6KB
|
153 lines
/************* dos.requester.c **********/
#include "intuall.h"
#include "imageedit.h"
struct Requester dosrequest;
struct IntuiText dosreqtext[3]; /* dos requester text */
struct IntuiText dostext[2]; /* dos gadget text */
extern struct TextAttr TestFont;
BYTE dosname[20];
BYTE undobuff[20];
/* this is the definition of the string gadget used for the dos requester */
struct StringInfo stringstuff = {
&dosname[0], /* default and final string */
&undobuff[0], /* optional undo buffer (later) */
0, /* character position in buffer */
20, /* max characters in buffer */
0, /* buffer position of first displayed
* character */
0,0,0,0,0,NULL,0 }; /* intuition local variables */
/* the cancel gadget lets people decide not to load or save */
struct Gadget CancelGadget = {
NULL, /* address of next gadget */
100,50,48,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* flags */
RELVERIFY | GADGIMMEDIATE | ENDGADGET,
/* tell me only when he releases the
* mouse button and if over the
* gadget at that time */
REQGADGET | BOOLGADGET, /* is a requestor, string */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&dostext[0], /* CANCEL */
0, /* mutual exclusion (could use) */
NULL, /* special info */
DISKRWGADGETS+0, /* gadget identifier, user */
NULL }; /* user data pointer */
/* the string gadget is supposed to pick up a file name for load and save */
struct Gadget DosNameGadget = {
&CancelGadget, /* address of next gadget */
20,26,140,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* Flags, complement mode, needed
* as of this writing for string
* gadgets */
RELVERIFY | GADGIMMEDIATE | ENDGADGET,
/* Activation flags, when user hits
* return, terminates
* input and deselects gadget */
REQGADGET | STRGADGET, /* is a requestor, string */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
NULL, /* intiutext to write there */
0, /* mutual exclusion (could use) */
&stringstuff, /* special info */
DISKRWGADGETS+1, /* identifier, user */
NULL }; /* user data pointer */
/* this one is only temporary.... string gadget is not transmitting GADGETUP
* when RETURN is hit (I THINK). So I want to add a gadget which will
* definitely let me exercise my code for load and save */
struct Gadget LoadSaveGadget = {
&DosNameGadget, /* address of next gadget */
5,50,40,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* flags */
RELVERIFY | GADGIMMEDIATE | ENDGADGET,
/* tell me only when he releases the
* mouse button and if over the
* gadget at that time */
REQGADGET | BOOLGADGET, /* is a requestor, string */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&dostext[1], /* load or save */
0, /* mutual exclusion (could use) */
NULL, /* special info */
DISKRWGADGETS+1, /* gadget identifier, user */
/* has same gadget id so either click load/save or
* type name and hit return starts the operation. */
NULL }; /* user data pointer */
InitDosRequest()
{
InitRequester(&dosrequest);
dosrequest.LeftEdge = 20;
dosrequest.TopEdge = 20;
dosrequest.Width = 230;
dosrequest.Height = 64;
dosrequest.ReqGadget = &LoadSaveGadget;
dosrequest.ReqText = &dosreqtext[0];
dosrequest.BackFill = 1;
dosreqtext[0].FrontPen = 0;
dosreqtext[0].BackPen = 1;
dosreqtext[0].DrawMode = JAM1;
dosreqtext[0].ITextFont = &TestFont;
dosreqtext[0].NextText = &dosreqtext[1];
dosreqtext[0].LeftEdge = 5;
dosreqtext[0].TopEdge = 40;
dosreqtext[0].IText = "Press Return To Begin";
dosreqtext[1].FrontPen = 0;
dosreqtext[1].BackPen = 1;
dosreqtext[1].DrawMode = JAM1;
dosreqtext[1].ITextFont = &TestFont;
dosreqtext[1].NextText = &dosreqtext[2];
dosreqtext[1].LeftEdge = 5;
dosreqtext[1].TopEdge = 13;
dosreqtext[1].IText = "Type Name:";
dosreqtext[2].FrontPen = 0;
dosreqtext[2].BackPen = 1;
dosreqtext[2].DrawMode = JAM1;
dosreqtext[2].ITextFont = &TestFont;
dosreqtext[2].NextText = NULL;
dosreqtext[2].LeftEdge = 5;
dosreqtext[2].TopEdge = 1;
dosreqtext[2].IText = "Click In Name Area";
return;
}
InitDosText()
{
SHORT n;
for(n=0; n<2; n++)
{
dostext[n].FrontPen = 1;
dostext[n].BackPen = 0;
dostext[n].DrawMode = JAM2;
dostext[n].ITextFont = &TestFont;
dostext[n].NextText = NULL;
dostext[n].LeftEdge = 0;
dostext[n].TopEdge = 2;
}
dostext[0].IText = "CANCEL";
dostext[1].IText = NULL; /* filled in at Event3.c, as
* Load or Save */
return;
}